package com.nuist.springmvcdemo.ds;

import java.util.LinkedList;
import java.util.Queue;

public class Queue_test {
    public static void main(String[] args) {
        Queue<Integer> queue = new LinkedList<>();

        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        queue.offer(5);  // 从队尾入队
        System.out.println(queue.size());
        System.out.println(queue.peek()); // 获取队头元素

        queue.poll(); // 从队头出队列, 并将删除的元素返回
        System.out.println(queue.poll());


    }
}
